package com.zmn.plat.manager.dictionary;

import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 全局单位字典
 *
 * @author nowind
 * @since 17/3/28 11:42
 */
public class ServProductUnitDict {

    private static List<String> partUnitList = Lists.newArrayListWithExpectedSize(29);

    public final static String UNIT_01 = "台";
    public final static String UNIT_02 = "个";
    public final static String UNIT_03 = "次";
    public final static String UNIT_04 = "条";
    public final static String UNIT_05 = "包";
    public final static String UNIT_06 = "根";
    public final static String UNIT_07 = "米";
    public final static String UNIT_08 = "对";
    public final static String UNIT_09 = "瓶";
    public final static String UNIT_10 = "盒";
    public final static String UNIT_11 = "副";
    public final static String UNIT_12 = "套";
    public final static String UNIT_13 = "组";
    public final static String UNIT_14 = "把";
    public final static String UNIT_15 = "件";
    public final static String UNIT_16 = "扇";
    public final static String UNIT_17 = "小时";
    public final static String UNIT_18 = "平米";
    public final static String UNIT_19 = "回路";
    public final static String UNIT_20 = "室";
    public final static String UNIT_21 = "公里";
    public final static String UNIT_22 = "点";
    public final static String UNIT_23 = "袋";
    public final static String UNIT_24 = "桶";
    public final static String UNIT_25 = "卷";
    public final static String UNIT_26 = "支";
    public final static String UNIT_27 = "张";
    public final static String UNIT_28 = "个/平米/米";
    public final static String UNIT_29 = "平米/米";

    /**
     * 单位无ID，直接以String返回
     */
    public static List<String> getUnitList() {
        return partUnitList;

    }

    public static void main(String[] args) {
        long startTime = System.currentTimeMillis();
        ServProductUnitDict.getUnitList().forEach(System.out::print);
        long endTime = System.currentTimeMillis();
        System.out.println("\n所用时间:" + (endTime - startTime));
    }

    static {
        try {
            Class clazz = Class.forName("com.zmn.plat.manager.dictionary.ServProductUnitDict");
            partUnitList = new ArrayList<>(Arrays.asList(clazz.getFields())).stream().map(field -> {
                String str = null;
                try {
                    str = field.get(null).toString();
                } catch (IllegalAccessException e) {

                }
                return str;
            }).collect(Collectors.toList());

        } catch (Exception e) {

        }
    }
}
